package com.lianzhihui.romeex.ui;

import android.content.Intent;
import android.view.View;

import com.lianzhihui.romeex.ui.account.ImportWalletActivity;
import com.lianzhihui.romeex.ui.account.SetNameSaftyActivity;
import com.lianzhihui.romeex.adapter.ImageAdapter;
import com.lianzhihui.romeex.bean.BannerBean;
import com.lianzhihui.romeex.R;
import com.lianzhihui.romeex.ui.base.BaseActivity;
import com.lianzhihui.romeex.utils.LogUtil;
import com.youth.banner.Banner;
import com.youth.banner.indicator.CircleIndicator;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Description:
 * Author: RAMON
 * CreateDate: 2020/10/23 11:15 AM
 * UpdateUser:
 * UpdateDate:
 * UpdateRemark:
 * Version:
 */
public class LoginActivity extends BaseActivity {

    @BindView(R.id.banner)
    Banner banner;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_login_layout;
    }

    @Override
    protected void initView() {
//        useBanner();
    }

    @Override
    protected void initData() {

    }

    public void useBanner() {

        List<BannerBean> bannerData = new ArrayList<>();
        bannerData.add(new BannerBean());
        bannerData.add(new BannerBean());
        bannerData.add(new BannerBean());

        ImageAdapter adapter = new ImageAdapter(this, bannerData);
        banner.setAdapter(adapter);
        banner.setIndicator(new CircleIndicator(this));

    }

    @Override
    protected void onStart() {
        super.onStart();
        //开始轮播
        banner.start();
    }

    @Override
    protected void onStop() {
        super.onStop();
        //停止轮播
        banner.stop();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        //销毁
        if (banner != null) {
            LogUtil.error("ramon", "destroy");
            banner.destroy();
        } else {
            LogUtil.error("ramon", "banner null");
        }
    }

    @OnClick({R.id.bt_create, R.id.bt_import})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.bt_create:
                //创建钱包
                startActivity(new Intent(this, SetNameSaftyActivity.class));
                break;
            case R.id.bt_import:
                //导入钱包
                Intent intent = new Intent(this, ImportWalletActivity.class);
                startActivity(intent);
                break;
        }
    }

}
